<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\modules\clinical\models\GeneInfo;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '基因报告搜索';
$this->registerJsFile('@web/js/search.js?v=1', ['depends' => 'app\assets\AppAsset']);
?>
<style type="text/css">
    .search-div > div > table {width: 1900px !important;}
</style>

<p>
    <?= Html::a('清空搜索', ['/search/gene'], ['class' => 'btn btn-primary']) ?>
</p>

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        [
            'class' => 'yii\grid\ActionColumn',
            'buttons' =>[
                'view' => function($url, $model, $key) {
                    return Html::a('<i class="fa fa-paper-plane"></i>', '/search/search/enter/?id='.$model->pt_id.'&type=gene');
                },
            ],
            'template' => '{view}',
        ],

        [
        	'attribute' => 'ppt_id',
        	'value' => function($data) {
                return isset($data->patient->pt_id) ? $data->patient->pt_id : '';
        	}
        ],
        [
        	'attribute' => 'pt_name',
        	'value' => function($data) {
                return isset($data->patient->pt_name) ? $data->patient->pt_name : '';
        	}
        ],
        [
            'attribute' => 'ck_comp',
            'value' => function($data) {
              return GeneInfo::getParams('deliver_comp')[$data->ck_comp];
            },
            'filter' => GeneInfo::getParams('deliver_comp'),
        ],
        'ck_program',
        [
            'attribute' => 'rp_time',
            'filterInputOptions' => ['class' => 'form-control', 'type' => 'date'],
        ],
        'charge_name',
        [
            'attribute' => 'disc_time',
            'filterInputOptions' => ['class' => 'form-control', 'type' => 'date'],
        ],
        [
            'attribute' => 'isSent',
            'value' => function($data) {
                return GeneInfo::getParams('isSent')[$data->isSent];
            },
            'filter' => GeneInfo::getParams('isSent'),
        ],
        [
            'attribute' => 'recheck_time',
            'filterInputOptions' => ['class' => 'form-control', 'type' => 'date'],
        ],
        [
            'attribute' => 'ck_time',
            'filterInputOptions' => ['class' => 'form-control', 'type' => 'date'],
        ],
        'crt_name',
        'crt_time',
    ],
]); ?>
